<!DOCTYPE html>
<html>
<head>
<title>附件管理</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<link rel="stylesheet" href="../../../css/bootstrap.min.css">
<link rel="stylesheet" href="../../../css/font-awesome.min.css">
<link rel="stylesheet" href="../../../plugins/jqgrid/ui.jqgrid-bootstrap.css">
<link rel="stylesheet" href="../../../css/main.css">
<script src="../../../libs/jquery.min.js"></script>
<script src="../../../plugins/layer/layer.js"></script>
<script src="../../../libs/bootstrap.min.js"></script>
<script src="../../../libs/vue.min.js"></script>
<script src="../../../plugins/jqgrid/grid.locale-cn.js"></script>
<script src="../../../plugins/jqgrid/jquery.jqGrid.min.js"></script>
<script src="../../../js/common.js"></script>
<script src="../../../libs/ajaxupload.js"></script>
</head>
<body>
<div id="rapp" v-cloak>
	<div v-show="showList">
		<div class="panel panel-default">
			<div class="panel-heading">
				功能操作
			</div>
			<div class="panel-body">
				<div class="row">
					<div class="form-group col-sm-2">
						<input type="text" class="form-control" v-model="q.title" @keyup.enter="query" placeholder="标题">
					</div>
					<div class="form-group col-sm-2">
						<select class="form-control" v-model="q.mime_type" >
							<option value="">选择类型</option>
							<option value="application">文件</option>
							<option value="image">图像</option>
							<option value="audio">音频</option>
							<option value="video">视频</option>
						</select>
					</div>
				</div>
				<div class="grid-btn">
					<a class="btn btn-default" @click="query">查询</a>
					<a class="btn btn-default" @click="refresh">刷新</a>
					<a v-if="hasPermission('sys:attachment:info')" class="btn btn-info" @click="info"><i class="fa fa-info"></i>&nbsp;查看</a>
					<a v-if="hasPermission('sys:attachment:upload')" class="btn btn-success" id="upload"><i class="fa fa-upload"></i>&nbsp;上传文件</a>
					<a v-if="hasPermission('sys:attachment:download')" class="btn btn-primary" @click="download"><i class="fa fa-download"></i>&nbsp;下载文件</a>
					<a v-if="hasPermission('sys:attachment:delete')" class="btn btn-danger" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
				</div>
			</div>
		</div>
	    <table id="jqGrid"></table>
	    <div id="jqGridPager"></div>
    </div>

	<!--查看附件-->
	<div id="attachmentInfoLayer" style="display: none;">
		<form class="form-horizontal">
			<div class="form-group">
				<label class="col-sm-2 control-label">标题</label>
				<div class="col-sm-6">
					<p class="form-control-static">{{attachment.title}}</p>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">缩略图</label>
				<div class="col-sm-6">
					<p class="form-control-static" v-if="mimeType.indexOf('image') >= 0">
						<img class="img-thumbnail" style="width: 250px;height: 250px;" :src="uploadFileResource+attachment.path" >
					</p>
					<p class="form-control-static" v-if="mimeType.indexOf('audio') >= 0">
						<img class="img-thumbnail" style="width: 250px;height: 250px;" :src="baseURL+'image/audio.jpg'" >
					</p>
					<p class="form-control-static" v-if="mimeType.indexOf('video') >= 0">
						<img class="img-thumbnail" style="width: 250px;height: 250px;" :src="baseURL+'image/video.jpg'" >
					</p>
					<p class="form-control-static" v-if="mimeType.indexOf('application') >= 0">
						<img class="img-thumbnail" style="width: 250px;height: 250px;" :src="baseURL+'image/file.jpg'" >
					</p>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">路径</label>
				<div class="col-sm-6">
					<p class="form-control-static">{{attachment.path}}</p>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">后缀</label>
				<div class="col-sm-6">
					<p class="form-control-static">{{attachment.suffix}}</p>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">类型</label>
				<div class="col-sm-6">
					<p class="form-control-static">{{attachment.mimeType}}</p>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">创建时间</label>
				<div class="col-sm-6">
					<p class="form-control-static">{{attachment.createTime}}</p>
				</div>
			</div>
		</form>
	</div>

</div>

<script src="../../../js/modules/sys/attachment.js"></script>
</body>
</html>